//
//  Extension.swift
//  bailikaoshi
//
//  Created by 刘浩宇 on 2021/5/24.
//  Copyright © 2021 Bailitop-iOS. All rights reserved.
//

import UIKit

//扩展NSRange，添加转换成Range的方法
extension NSRange {
    func toRange(string: String) -> Range<String.Index>
    {
        let startIndex = string.index(string.startIndex, offsetBy: self.location)
        let endIndex = string.index(startIndex, offsetBy: self.length)
        return startIndex..<endIndex
    }
}

